/**
 * Created with IntelliJ IDEA.
 * Description:
 * https://gitee.com/li--jiaqiang/java-test.git
 * git pull
 * git pull origin master
 * git pull origin master --allow-unrelated-histories
 * User: 86187
 * Date: 2022-04-27
 * Time: 22:14
 */

//Scanner scan = new Scanner(System.in);

import java.util.Scanner;

public class TestDemo2 {

    /**
     * 求1！+2！+3！+4！+........+n!的和
     * @param n
     * @return
     */
    public static int myStratum(int n) {
        int sum = 1;
        int ans = 0;
        for (int i = 1; i <= n ; i++) {
            sum *= i;
            ans += sum;
        }
        return ans;
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        System.out.println("1到"+n+"的阶层之和为:"+myStratum(n));
    }
}
